function StockCanvas(){
	this.canvas = null;
	this.name = null;
	this.ctx = null;
	this.c_height = null;
	this.c_width = null;
	this.min_c_height = 400;
}

/*
*	Initialize the canvas
*/
StockCanvas.prototype.InitCanvas = function(name,height,width){
	this.canvas = document.getElementById(name);
    if(this.canvas.getContext("2d")){
    	this.name = name;
		this.ctx = this.canvas.getContext("2d");
		this.c_height = Math.max(height,this.min_c_height);
		this.c_width = width;
		this.ctx.canvas.width = this.c_width;
		this.ctx.canvas.height = this.c_height;
		return true;
    }
    return false;
}

/*
*	Handle Canvas Resize
*/
StockCanvas.prototype.SetSize = function(height,width){
	this.c_height = Math.max(height, this.min_c_height);
	this.c_width = width;
	this.ctx.canvas.width = this.c_width;
	this.ctx.canvas.height = this.c_height;
}

/*
*	Main Drawing Function
*/
StockCanvas.prototype.DrawCanvas = function(){
	//this.ctx.beginPath();
    this.ctx.strokeStyle = 'rgb(237,239,244)';
	this.ctx.fillStyle = "rgb(237,239,244)";
    //this.ctx.rect(0,0,this.c_width,this.c_height);
    //this.ctx.closePath();
    //this.ctx.fill();	
    roundRect(this.ctx, 0, 0, this.c_width, this.c_height, 10, true); 
}

/**
 * Draws a rounded rectangle using the current state of the canvas. 
 * If you omit the last three params, it will draw a rectangle 
 * outline with a 5 pixel border radius 
 * @param {CanvasRenderingContext2D} ctx
 * @param {Number} x The top left x coordinate
 * @param {Number} y The top left y coordinate 
 * @param {Number} width The width of the rectangle 
 * @param {Number} height The height of the rectangle
 * @param {Number} radius The corner radius. Defaults to 5;
 * @param {Boolean} fill Whether to fill the rectangle. Defaults to false.
 * @param {Boolean} stroke Whether to stroke the rectangle. Defaults to true.
 */
function roundRect(ctx, x, y, width, height, radius, fill, stroke) {
  if (typeof stroke == "undefined" ) {
    stroke = true;
  }
  if (typeof radius === "undefined") {
    radius = 5;
  }
  ctx.beginPath();
  ctx.moveTo(x + radius, y);
  ctx.lineTo(x + width - radius, y);
  ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
  ctx.lineTo(x + width, y + height - radius);
  ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
  ctx.lineTo(x + radius, y + height);
  ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
  ctx.lineTo(x, y + radius);
  ctx.quadraticCurveTo(x, y, x + radius, y);
  ctx.closePath();
  if (stroke) {
    ctx.stroke();
  }
  if (fill) {
    ctx.fill();
  }        
}